package com.weyoung.app.service;

import com.weyoung.common.model.entity.VideoTask;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Service
public class VideoTaskManager {
    private final Map<String, VideoTask> tasks = new ConcurrentHashMap<>();

    public void addTask(VideoTask task) {
        tasks.put(task.getTaskId(), task);
    }

    public VideoTask getTask(String taskId) {
        return tasks.get(taskId);
    }

    public void updateTask(VideoTask task) {
        tasks.put(task.getTaskId(), task);
    }

    public void removeTask(String taskId) {
        tasks.remove(taskId);
    }

    public Map<String, VideoTask> getAllTasks() {
        return tasks;
    }
} 